# Contributor: Lennart Jablonka <humm@ljabl.com>
# Maintainer: Lennart Jablonka <humm@ljabl.com>
pkgname=git-filter-repo
pkgver=2.38.0
pkgrel=0
pkgdesc="quickly rewrite git repository history"
url="https://github.com/newren/git-filter-repo"
arch="noarch"
license="MIT"
source="
	10-no-version-test.patch
	20-git-filter-repo.patch
	https://github.com/newren/git-filter-repo/releases/download/v$pkgver/git-filter-repo-$pkgver.tar.xz
"
depends="python3 git"
checkdepends="bash perl rsync"
subpackages="$pkgname-doc"

check() {
	./t/run_tests
}

package() {
	install -Dm755 git-filter-repo "$pkgdir"/usr/bin/git-filter-repo
	local site=$(python3 -c 'import site; print(site.getsitepackages()[0])')
	mkdir -p "$pkgdir$site"
	ln -s -f /usr/bin/git-filter-repo "$pkgdir$site"/git_filter_repo.py
	install -Dm644 Documentation/man1/git-filter-repo.1 "$pkgdir"/usr/share/man/man1/git-filter-repo.1
}

sha512sums="
4dafe4458d2f7416d80269c38318f43eda1c389d9abbbdf9f7d4e8762917d774de119cd8792c192ee8e033e5381857450330ecd3320d87e5fc94423859642863  10-no-version-test.patch
6591ce9c93efbb1f534784daf2867cf03da43aeda70e25861f26cf31bd638cc3ecccacae14462917749ad0eabcfec386d800ad08558c980d1c6263b84ebd015f  20-git-filter-repo.patch
786c27c1952a5e3625c924e71958cfd61d9065d32754a3e957f258767ccb5b147778c5d499eb82c7c1bf36a2f5a50b1cde372ebbc927aeeedbd713e5ab6563d8  git-filter-repo-2.38.0.tar.xz
"
